/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.admin.controller;

import com.admin.model.EventLibraryFacadeLocal;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;

/**
 *
 * @author Tuan Long
 */
@Stateless
public class ShowEventEJB implements ShowEventEJBRemote {

    @EJB
    private EventLibraryFacadeLocal eventLibraryFacade;

    /**
     * @ShowEventEJB.fillEventsDataTable: return to List< -JSONObject String->,
     * with a JSONObject is the result from Select of database
     * @return List<>
     */
    @Override
    public List<String> fillEventsDataTable() {
        List<String> jsonlist = new ArrayList<String>();
        jsonlist = eventLibraryFacade.fillEventsDataTable();        
        return jsonlist; 
    }

    private void test_sp_testParameter() {
        List<String> list = eventLibraryFacade.testUseSPParameter("test");
        for (String eventLibraryJson : list) {
            System.out.println("Result: " + eventLibraryJson);
            System.out.println("-------------------------------");
        }
    }

    /**
     * @ShowEventEJB.fillRegisteredTable Desc: Get data from database, return
     * List<json-string>
     * @return List<>
     */
    @Override
    public List<String> fillRegisteredTable() {
        List<String> jsonlist = new ArrayList<String>();
        jsonlist = eventLibraryFacade.fillRegisteredTable();
        return jsonlist;
    }
    
    /**
     * @ShowEventEJB.fillTotalRegistered
     * @return List<>
     */
    @Override
    public List<String> fillTotalRegistered() {
        List<String> jsonlist = new ArrayList<String>();
        jsonlist = eventLibraryFacade.fillTotalRegistered(); 
        return jsonlist;
    }
 

}
